import http from "@/http/index.ts"
import {Quotation, QuotationListParam, QuotationShare, QuotationUpdateStatus} from '@/api/quotation/type.ts'


// 新增报价单
export const addApi = (data: Quotation) => {
    return http.post("/quotation/createQuotation", data)
}


// 编辑
export const editApi = (data: Quotation) => {
    return http.put("/quotation/updateQuotation", data)
}


// 分页条件查询列表
export const getListApi = (data:QuotationListParam) => {
    return http.get("/quotation/getQuotationList",data)
}

// 根据产品的id查询详情信息
export const getDetailByIdApi = (id:number) => {
    return http.get(`/quotation/getQuotationDetail/${id}`,)
}

// 修改报价单状态
export const updateStatusApi = (quotationUpdateStatus:QuotationUpdateStatus) => {
    return http.put(`/quotation/updateQuotationStatus`,quotationUpdateStatus)
}

// 分摊金额
export const updateQuotationShareApi = (quotationShare:QuotationShare) => {
    return http.put(`/quotation/updateQuotationShare`,quotationShare)
}

// 打印报价单
export const printQuotationApi = (ids: number[]) => {
    return http.get(`/quotation/printQuotation`, {  ids: ids.join(',') })
}
